<!doctype html>
<html prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#"  lang="en" dir="ltr">
<head>
	<meta charset="UTF-8" />
	<title><?php echo $title; ?></title>
	<meta name="resource-type" content="document" />
	<meta name="robots" content="all, index, follow"/>
	<meta name="googlebot" content="all, index, follow" />
<?php
	foreach($meta as $name=>$content)
	{
		echo "\n\t\t";
		echo meta($name, $content);
	}
	echo "\n";

	if(!empty($canonical))
	{
		echo "\n\t\t";
		echo link_tag($canonical, 'canonical');
	}
	echo "\n\t";
?>
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets/common/css/bootstrap.css" type="text/css" />
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets/common/css/bootstrap-theme.css" type="text/css" />
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets/common/css/icomoon.css" type="text/css" />
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets/common/css/bootstrap-datetimepicker.min.css" type="text/css" />
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets/<?= $this->output->template_name() ?>/css/main.css" type="text/css" />
<?php
	foreach($css as $file)
	{
	 	echo "\n\t\t";
		echo link_tag($file);
	} echo "\n\t";
?>
	<script type="text/javascript" src="<?php echo base_url(); ?>assets/common/js/jquery.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url(); ?>assets/common/js/jquery-ui.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url(); ?>assets/common/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url(); ?>assets/common/js/bootstrap-datetimepicker.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url(); ?>assets/<?= $this->output->template_name() ?>/js/site.js"></script>
<?php
	foreach($js as $file)
	{
			echo "\n\t\t";
			?><script src="<?php echo $file; ?>"></script><?php
	} echo "\n\t";
	
	echo $inline_scripting;
?>

</head>
<body>
	<div id="wapper">
		<div class="container">
			<div class="row">
				<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"><!-- navbar-fixed-top -->
					<div class="container">
						<!-- Brand and toggle get grouped for better mobile display -->
						<div class="navbar-header">
							<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navigation">
								<span class="sr-only">Toggle navigation</span>
								<span class="icon-bar"></span>
								<span class="icon-bar"></span>
								<span class="icon-bar"></span>
							</button>
							<a class="navbar-brand" href="<?= siteUrl('admin/dashboard'); ?>"><span class="icon-home"></span></a>
						</div>
						<!-- Collect the nav links, forms, and other content for toggling -->
						<div class="collapse navbar-collapse" id="navigation">

							<ul class="nav navbar-nav">
								<!-- USER -->
								<li class="dropdown<?php if(preg_match('/admin\/(user|usergroup)/', uri_string())) echo ' active' ?>">
									<a href="<?php echo site_url('admin/user'); ?>" class="dropdown-toggle disabled" data-toggle="dropdown" role="button" aria-expanded="false"><?= lang('user') ?> <span class="caret"></span></a>
									<ul class="dropdown-menu" role="menu">
										<li><a href="<?php echo site_url('admin/user/index'); ?>"><?= lang('manager') ?></a></li>
										<li><a href="<?php echo site_url('admin/user/form'); ?>"><?= lang('add_new') ?></a></li>
									</ul>
								</li>
								<!-- CATEGORY -->
								<li class="dropdown<?php if(preg_match('/admin\/category/', uri_string())) echo ' active' ?>">
									<a href="<?php echo site_url('admin/category'); ?>" class="dropdown-toggle disabled" data-toggle="dropdown" role="button" aria-expanded="false"><?= lang('category') ?> <span class="caret"></span></a>
									<ul class="dropdown-menu" role="menu">
										<li><a href="<?php echo site_url('admin/category/index'); ?>"><?= lang('manager') ?></a></li>
										<li><a href="<?php echo site_url('admin/category/form'); ?>"><?= lang('add_new') ?></a></li>
									</ul>
								</li>
								<!-- POST -->
								<li class="dropdown<?php if(preg_match('/admin\/post/', uri_string())) echo ' active' ?>">
									<a href="<?php echo site_url('admin/post'); ?>" class="dropdown-toggle disabled" data-toggle="dropdown" role="button" aria-expanded="false"><?= lang('post') ?> <span class="caret"></span></a>
									<ul class="dropdown-menu" role="menu">
										<li><a href="<?php echo site_url('admin/post/index'); ?>"><?= lang('manager') ?></a></li>
										<li><a href="<?php echo site_url('admin/post/form'); ?>"><?= lang('add_new') ?></a></li>
									</ul>
								</li>
								<!-- MENU -->
								<li class="dropdown<?php if(preg_match('/admin\/menu/', uri_string())) echo ' active' ?>">
									<a href="<?php echo site_url('admin/menu'); ?>" class="dropdown-toggle disabled" data-toggle="dropdown" role="button" aria-expanded="false"><?= lang('menu') ?> <span class="caret"></span></a>
									<ul class="dropdown-menu" role="menu">
										<li><a href="<?php echo site_url('admin/menu/index'); ?>"><?= lang('manager') ?></a></li>
										<li><a href="<?php echo site_url('admin/menu/form'); ?>"><?= lang('add_new') ?></a></li>
									</ul>
								</li>
							</ul>
							
							<ul class="nav navbar-nav navbar-right">
								<li><a href="<?= base_url() ?>" target="_blank"><?= word_limiter(lang('site_name'), 3) ?> <span class="icon-out-2 small"></span></a></li>
								<li class="dropdown">
									<a href="javascript:;" data-toggle="dropdown" class="dropdown-toggle"><span class="icon-cog"></span>
									<b class="caret"></b></a>
									<ul class="dropdown-menu pull-right" role="menu">
										<li>
											<span>
												<span class="icon-user"></span>
												<strong><?= $this->user->fullname ?></strong>
											</span>
										</li>
										<li><a href="<?= siteUrl('admin/user/editdetail') ?>"><?= lang('user_edit_detail') ?></a></li>
										<li><a href="<?= siteUrl('admin/user/changepassword') ?>"><?= lang('user_change_password') ?></a></li>
										<li><a href="<?= siteUrl('user/logout') ?>"><span class="icon-exit"></span> <?= lang('logout') ?></a></li>
									</ul>
								</li>
								<li><a href="javascript:;" class="switch_lang" title="<?= lang('switch_language') ?>"><span class="ico_<?= $this->config->item('language') ?>"></span> <span class="label label-success"><?= lang($this->config->item('language')) ?></span> <b class="caret"></b></a></li>
							</ul>
						</div><!-- /.navbar-collapse -->
					</div>
				</nav>
			</div>
		</div><!-- /.container-fluid -->
		<div id="main">
			<div class="container">
				<div id="messages-alert">
					<!-- AJAX -->
					<?= $this->messages->display() ?>
				</div>
				<?php if($this->load->get_section('text_header') != '') { ?>
					<h1><?php echo $this->load->get_section('text_header');?></h1>
				<?php }?>
				<?php echo $output;?>
				<?php echo $this->load->get_section('sidebar'); ?>
			</div>
		</div><!-- /#main -->
	</div>

	<div id="switch_language_pop" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="languageModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h1 class="modal-title" id="languageModalLabel"><?= lang('choose_language') ?></h1>
				</div>
				<div class="modal-body row">
					<div class="col-sm-6">
						<div class="well"><h2><span class="icon-flag"></span> &nbsp; <a href="<?= base_url('admin/?lang=vi') ?>"><?= lang('vietnamese') ?></a></h2></div>
					</div>
					<div class="col-sm-6">
						<div class="well"><h2><span class="icon-flag"></span> &nbsp; <a href="<?= base_url('admin/?lang=en') ?>"><?= lang('english') ?></a></h2></div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
		function reload_msg()
		{
			$('#messages-alert').load('<?= site_url('message') ?>');
		}
		<?php if(!in_array(get_cookie($this->config->item('cookie_language')), array('en', 'vi'))): ?>
		$(function(){
			$('#switch_language_pop').modal({show:true})
		});
		<?php endif ?>

		$('.switch_lang').click(function(){
			$('#switch_language_pop').modal({show:true})
		});
	</script>
</body>
</html>